package com.bus.common.web.freemarker;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bus.boot.action.directive.BusGuestbookCtgListDirective;
import com.bus.boot.action.directive.BusGuestbookListDirective;
import com.bus.boot.action.directive.BusGuestbookPageDirective;
import com.bus.boot.action.directive.PaginationDirective;

import freemarker.template.Configuration;
import freemarker.template.TemplateModelException;

@Component
public class ConfigFreemarkerDirective {
	
	@Autowired
	private Configuration config;
	
	@Autowired
	private ProcessTimeDirective process_time;
	@Autowired
	private UUIDDirective uuid;
	@Autowired
	private TextCutDirective text_cut;
	@Autowired
	private HtmlCutDirective html_cut;
	
	@Autowired
	private PaginationDirective bus_pagination;
	
	@Autowired
	private BusGuestbookListDirective bus_guestbook_list;
	@Autowired
	private BusGuestbookPageDirective bus_guestbook_page;
	@Autowired
	private BusGuestbookCtgListDirective bus_guestbook_ctg_list;
	
	@PostConstruct
	public void setSharedVariable() throws TemplateModelException
	{
		config.setSharedVariable("process_time",process_time);
		config.setSharedVariable("uuid",uuid);
		config.setSharedVariable("text_cut",text_cut);
		config.setSharedVariable("html_cut",html_cut);
		
		config.setSharedVariable("bus_pagination",bus_pagination);
		
		config.setSharedVariable("bus_guestbook_list",bus_guestbook_list);
		config.setSharedVariable("bus_guestbook_page",bus_guestbook_page);
		config.setSharedVariable("bus_guestbook_ctg_list",bus_guestbook_ctg_list);
	}
	
}
